<!--
	作者：2575202388@qq.com
	时间：2018-10-14
	描述：首页统计
-->

<template>
    <Card :bordered="false" style="height:430px;">
        <p slot="title">
         	<Icon type="md-pie" style="color:#5d5386;font-size: 18px;"/>	             	
        	<span style="padding-left:2px;color:#333333;font-size: 14px;font-weight: normal;">登记统计四</span>
        </p>
        <div style="width:100%;float:left;text-align: center;" align="center">
        	<div ref="static4" style="width:100%;min-width: 600px; float:left;height:330px;"></div>
        </div>
    </Card>
</template>

<script>
	import Highcharts from 'highcharts'
	require('highcharts/modules/exporting')(Highcharts);
	export default {
		name:"static4",
		props: {
    		townlist:{
    			type: Array
    		}
    	},
		components: {
		},
		mounted(){
		    
		},
		methods: {
		    drawLine(){
		     	var townlist=this.townlist;
		     	var carr=[];
		     	var varr=[];
		     	for(var i=0;i<townlist.length;i++){
		     		carr.push(townlist[i].VANAME);
		     		if(townlist[i].COUNTS){
		     			varr.push(townlist[i].COUNTS);
		     		}else{
		     			varr.push(0);
		     		}
		     	}
		  
		    	var chart = Highcharts.chart(this.$refs.static4, {
					title: {
						text: '地区登记统计表'
					},
					xAxis: {
						categories: carr
					},
					lang:{ 
						downloadJPEG: "下载JPEG 图片",  
						downloadPDF: "下载PDF文档"  ,
						downloadPNG: "下载PNG 图片",
						downloadSVG: "下载SVG 矢量图" , 
						exportButtonTitle: "导出图片"  ,
				    },  
					yAxis: {
				        min: 0,
				        title: {
				            text: '人数'
				        }
				    },
					plotOptions: {
						series: {
							stacking: 'normal'
						}
					},
					labels: {
						items: [{
							html: '各地区登记人数',
							style: {
								left: '100px',
								top: '18px',
								color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
							}
						}]
					},
					series: [{
						type: 'column',
						name: '地区登记人数',
						data: varr
					}, {
						type: 'spline',
						name: '走向图',
						data: varr,
						marker: {
							lineWidth: 2,
							lineColor: Highcharts.getOptions().colors[3],
							fillColor: 'white'
						}
					}]
				});
		    }
		},
		watch:{
			townlist(news,olds){
				if(news){
					this.drawLine();
				}
			}
		},
	}
</script>

<style>
</style>



